#include "SceneManager.h"
#include "scene/TollgateEditorScene/TollgateEditorScene.h"
#include "scene/NormalTollgateScene/NormalTollgateScene.h"
#include "scene/CrazyTollgateScene/CrazyTollgateScene.h"
#include "scene/MainScene/MainScene.h"
#include "scene/NormalScoreScene/NormalScoreScene.h"
#include "scene/OptionScene/OptionScene.h"
#include "scene/CrazyScoreScene/CrazyScoreScene.h"

SceneManager* SceneManager::m_sceneManager = NULL;

SceneManager* SceneManager::shareSceneManager(){
	if(m_sceneManager == NULL){
		m_sceneManager = SceneManager::create();
	}

	return m_sceneManager;
}

bool SceneManager::init(){
	bool bRet = false;
	do{

		return true;
	}while(0);
}

void SceneManager::changeScene(EnumSceneType enSceneType){
	CCScene* scene = NULL;

	switch (enSceneType)
	{
	case enNormalTollgateScene:
		scene = NormalTollgateScene::scene();
		break;
	case enCrazyTollgateScene:
		scene = CrazyTollgateScene::scene();
		break;
	case enTollgateEditorScene:
		scene = TollgateEditorScene::scene();
		break;
	case enGameOverScene:
		break;
	case enMainScene:
		scene = MainScene::scene();
		break;
	case enNormalScoreScene:
		scene = NormalScoreScene::scene();
		break;
	case enOptionScene:
		scene = OptionScene::scene();
		break;
	case enCrazyScoreScene:
		scene = CrazyScoreScene::scene();
		break;
	}

	if(scene == NULL){
		return;
	}
	CCLog("change scene");
	CCDirector* director = CCDirector::sharedDirector();
	CCScene* curScene = director->getRunningScene();
	if(curScene == NULL){
		director->runWithScene(scene);
	} else{
		director->replaceScene(scene);
	}
}